package com.acme;


class Foo {
	public static int numOfIter = -1;
	byte array[] = new byte[1024];
	protected void finalize() throws Throwable {
		numOfIter++;
		super.finalize();
		System.out.println("GC is called at " + numOfIter + " iteration");
	}
}

public class GCTest {

	public static void main(String[] args) {
		int numberOfIterations = 1000000;
		Foo[] mass = new Foo[numberOfIterations];
		
		for (int i = 0; i < numberOfIterations; i++) {
			Foo foo = new Foo();
		}
		for (int i = 0; i < numberOfIterations; i++) {
			mass[i] = new Foo();
	}
}
